package top.mcwebsite.playandroid.home.vm

import top.mcwebsite.playandroid.business.articles.api.model.ArticleModel
import top.mcwebsite.playandroid.common.uiWidget.ErrorModel
import top.mcwebsite.playandroid.home.model.BannerModel
import top.mcwebsite.playandroid.lib.mvi.base.IIntent
import top.mcwebsite.playandroid.lib.mvi.base.IUiEffect
import top.mcwebsite.playandroid.lib.mvi.base.IUiState
import top.mcwebsite.playandroid.lib.mvi.model.Async

data class HomeUiState(
    val errorModel: ErrorModel? = null,
    val isRefreshing: Boolean = false,
    val asyncBanners: Async<List<BannerModel>> = Async.UnInitialization,
    val topArticleModels: List<ArticleModel> = emptyList(),
): IUiState

sealed interface HomePageIntent : IIntent {
    data class OnClickBannerIntent(val bannerModel: BannerModel) : HomePageIntent

    data class OnClickArticleIntent(val articleModel: ArticleModel) : HomePageIntent
}

sealed interface HomePageUiEffect : IUiEffect {
    data class NavigationToArticleDetailPageUiEffect(val articleLink: String) : HomePageUiEffect
}